package com.atguigu.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
  * create by undeRdoG on  2021-06-08  13:14
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Spark01_RDD_Oprator_Transform_Test {

  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setAppName("Operator").setMaster("local[*]")
    val sc = new SparkContext(sparkConf)
    /*
    * 获取log中的url
    * */
    val log: RDD[String] = sc.textFile("datas/apache.log")

    val urlLog: RDD[String] = log.map(line => {
      val splitLine: Array[String] = line.split(" ")
      splitLine(splitLine.length - 1)
    })
    urlLog.collect().foreach(println)

  }

}
